Prover: Invalid Inputs

Proves that an input was invalid, i.e. a non-existent state element was spent.

A valid transaction proof, proof, must be provided. In addition, a valid transaction proof block header for the output being spent, inputProof must be provided. Since this output might not exist, the transaction proof does not need to be valid, only the block header.

  1. Get input input as proof.transaction.inputs(proof.inputIndex).
  2. If the input's type is Deposit:
    1. The deposit with that deposit ID must have amount of 0 (i.e. a non-deposit is being spent).
  3. Get metadata metadata as proof.transaction.metadata[proof.inputIndex].
  4. The metadata's root index metadata.rootIndex must be at least inputProof.rootHeader.rootLength (i.e. metadata root index out of bounds).
  5. If the input's type is Transfer or HTLC:
    1. If the input proof is for the rightmost leaf in the root's transaction tree, then the metadata's transaction index metadata.transactionIndex must be greater than inputProof.transactionIndex. It's impossible to provide an inclusion proof for an out-of-bounds transaction, so this check serves as a check for this condition.
    2. The transaction leaf must be non-empty, i.e. inputProof.transaction.length must be greater than 0.
    3. The metadata's output index metadata.outputIndex must be at least inputProof.transaction.outputs.length() (i.e. metadata output index out of bounds).
    4. The output's type must be Withdraw or Return (i.e. spending a non-spendable output).
    5. If the input's type is Transfer:
      1. The output's type must not be Transfer (i.e. type mismatch).
    6. If the input's type is HTLC:
      1. The output's type must not be HTLC (i.e. type mismatch).
      2. If proof.blockHeader.blockNumber is less than inputProof.transaction.outputs(inputProof.outputIndex).expiry (i.e. the timelock has not expired):
        1. The hashlock digest inputProof.transaction.outputs(inputProof.outputIndex).digest must not match the hash of the preimage input.preImage (i.e. invalid preimage).